<?php include_once('header.php');?>
	<div class="main-content">
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
			<ul class="breadcrumb">
				<li>
					<i class="icon-home home-icon"></i>
					车辆管理
				</li>
				<li>
					车辆列表
				</li>
			</ul>
		</div>
		<div class="page-content">
			<div class="page-header">
				<h1 class="blue"><i class="icon-edit"></i> 添加车辆信息</h1>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<form class="form-horizontal" enctype="multipart/form-data" role="form" method="post" action="/www/vehicle/add"  onsubmit="return check()">
						<input type="hidden" class="form-control" id="user_id" name="user_id" value="<?php echo $user_info['id'];?>">
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">会员姓名:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" readonly="readonly" value="<?php echo $user_info['username'];?>">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">联系地址:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" readonly="readonly" value="<?php echo $user_info['addr'].$user_info['address'];?>">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">车主名:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="vehicle_owner" name="vehicle_owner" value="<?php echo $user_info['username'];?>">
							</div>
						</div>						
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">手机号码:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="phone" name="phone" value="<?php echo $user_info['phone'];?>">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">身份证号:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="card_num" name="card_num" value="">
							</div>
						</div>	
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">车型号:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="vehicle_model" name="vehicle_model" value="">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">车牌号:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="car_num" name="car_num" value="">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">发动机:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="engine" name="engine" value="">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">车架号:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="frame_num" name="frame_num" value="">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">上季度保险公司:</label>
							<div class="col-sm-6">
								<select name="company_name" class="form-control">										
									<?php 
										foreach ($company_list as $key => $value) {
											echo '<option value="'.$value['company_name'].'">'.$value['company_name'].'</option>';
									}
									?>							
								</select>								
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">备注:</label>
							<div class="col-sm-6">
								<textarea class="form-control" rows="4" name="remark"></textarea>
							</div>
						</div>
					 	<div class="form-group">
					   		<div class="col-sm-offset-1 col-sm-10">
								<button type="submit" id="submit" class="btn btn-primary">确定</button>
								<button type="submit" id="cancel" class="btn btn-primary">取消</button>
							</div>
					  	</div>
					</form>	
				</div>
			</div>					
		</div>													
	</div>
<?php include_once('content.php');?>
	<link href="/public_source/www/assets/css/ace.min.css" rel="stylesheet" />	
	<link href="/public_source/www/assets/css/jquery.tag-editor.css" rel="stylesheet"/>
    <script src="/public_source/www/assets/js/bootbox.min.js"></script>  
	<script src="/public_source/www/assets/js/jquery.tag-editor.min.js"></script>
	<script src="/public_source/www/js/areas.js"></script>
<?php include_once('footer.php');?>	
<script type="text/javascript">
	$(document).ready(function(){
		$("#cancel").click(function() {
			window.location.replace('/www/user/user_list');
			return false;
		});
	});
	function check() {
	   var vehicle_owner = document.getElementById("vehicle_owner").value;
	   var vehicle_model = document.getElementById("vehicle_model").value;
	   var car_num = document.getElementById("car_num").value;
	   var card_num = document.getElementById("card_num").value;
	   var engine = document.getElementById("engine").value;
	   var frame_num = document.getElementById("frame_num").value;
	   var phone = document.getElementById("phone").value;
	   var phoneReg=/^0?1[3584][0-9][0-9]{8}$/;
	   if(vehicle_owner ==  null || vehicle_owner == '') {
	        alert("车主名不能为空");
	        return false;
	   }
	   if(phone ==  null || phone == '') {
	        alert("手机号码不能为空");
	        return false;
	   }
	   if(!phoneReg.test(phone)){
	        alert("手机号码格式错误");
	        return false
	 	}
	   if(card_num ==  null || card_num == '') {
	        alert("身份证号不能为空");
	        return false;
	   }
	   if(vehicle_model ==  null || vehicle_model == '') {
	        alert("车型号不能为空");
	        return false;
	   }
	   if(car_num ==  null || car_num == '') {
	        alert("车牌号不能为空");
	        return false;
	   }
	   if(engine ==  null || engine == '') {
	        alert("发动机不能为空");
	        return false;
	   }
	   if(frame_num ==  null || frame_num == '') {
	        alert("车架号不能为空");
	        return false;
	   }
	   return true;
	}			
</script>		